package com.txm.activityMQ;

import org.apache.activemq.ActiveMQConnectionFactory;

import javax.jms.*;

public class MQProducer {
    private static String url="tcp://192.168.0.160:61616";
    private static String queueName="queue";
    public static void main(String[] args) throws JMSException {
        ConnectionFactory connectionFactory=new ActiveMQConnectionFactory(url);
        Connection connection=connectionFactory.createConnection();
        connection.start();;
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Destination destination = session.createQueue(queueName);
        MessageProducer messageProducer = session.createProducer(destination);
        TextMessage textMessage = session.createTextMessage("123");
        messageProducer.send(textMessage);
        connection.close();
    }
}
